<?php
header('Content-Type:text/html;Charset=UTF-8');

session_start();

if(isset($_SESSION['userId'])){

}else {
	die('<h3>登录信息不完整</h3><a href="/index.php">返回重新登录</a>');
};

@$id = $_SESSION['userId'];

@$mid = $_REQUEST['mid'];
@$cid = $_REQUEST['cid'];

require 'lib/db.php';

@$users = dbSelect("select u.id as uid,login,password,roleId,r.name as rname,w.id as wid,w.name as wname,age,sex,contact,address,img from users as u join role as r on u.roleId=r.id join worker as w on u.id=w.id",array('id'=>$id));

@$myClient = dbSelect("select clientId from myClient where id=:id",array('id'=>$mid));

@$client = dbSelect("select name,age,sex,contact,address from client where id=:id",array('id'=>$cid));

@$product = dbSelectAll('select id,name,price,img from product');


?>

<!DOCTYPE html>
<html>
   <head>
      <title>CRM客户关系管理系统</title>
	  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" charset="UTF-8" >
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
  	  <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="bootstrap/css/bootstrap-submenu.css" rel="stylesheet">
      <link href="bootstrap/css/superfish.css" rel="stylesheet">
      <link href="bootstrap/css/superfish-vertical.css" rel="stylesheet">
      <script src="bootstrap/js/jquery-1.11.1.min.js"></script>
      <script src="bootstrap/js/bootstrap.min.js"></script>
      <script src="bootstrap/js/bootstrap-submenu.js"></script>
      <script src="bootstrap/js/superfish.js"></script>
      <!--[if lt IE 9]>
         <script src="js/html5shiv.js"></script>
         <script src="js/respond.min.js"></script>
      <![endif]-->
   </head>
  <script src="lib/menu.js"></script>
  <script src="lib/red.js"></script>
  <script src="lib/dialog.js"></script>
  <script src="lib/product.js"></script>
<script>
$(function(){
		$('.menus').menu();

		$.ajaxSetup({
			dataType:'JSON',
			error:function(){
				alert('服务器交互出错！');
				}
			});
		$('#logoutBtn').click(function(){
			confirmDialog('提示','确定退出？');
			$('#confirm').click(function(){
				});
			});

		$('#select').click(function(){
			
			});
		
	});
</script>
<style>
	#confirm{color:red}
	.header{background:#681709}
	.modaltitle{color:white;font-size:20px}
	.navbar{background:#681709;}
	.marginal{height:10px;background:red}
	.title{font-size:30px;text-align:cneter;}
	#span{color:#e8e8e8;}
	#c{color:#ff8d1c;}
	#R{color:#ffff1e;}
	#M{color:#00ff00;}
	#logoutBtn{font-size:18px;color:red}
	.font{margin:0px;height:59px;text-align:center;width:270px;background:#681709}
	#user{border:solid 1px;width:240px;height:32px;text-align:left;background:black;color:white}
	#users{width:80px;float:left;border:solid 1px;background:black;color:white}
	#marginal{height:490px;width:15px;background:#681709;border-radius:10px;float:left}
	.menus a{display:block;width:200px;font-size:25px;}
    .menu{display:none;text-align:center}
     #a{font-size:16px;color:white;background:#681709}
    .titles{border:solid 3px;width:210px;border-radius:15px}
    .panel{color:#681709;border:solid 3px}
#FirstBtn{font-size:18px;color:red}
.col{color:#681709;border:solid 3px;margin:10px}
#Panel{background:#681709;color:white}
.main{height:auto;width:450px}
 </style>
  <body>
  	<nav class="navbar navbar-default">
 			<div class="row navbar-form">
 				<div class="col-xs-3 title">
 					<span id="c">C</span><span id="R">R</span><span id="M">M</span><span id="span">客户关系管理系统</span>
 				</div>
 				<div class="col-xs-6 text-right fonts">
 					
 				</div>
 				<div class="col-xs-3 text-right font">
 					<div id="user">
 					<img src="img/<?php echo $users['img']; ?>" style="width: 20px;height: 20px">
 					在线用户：<?php echo $users['wname']; ?>--<<?php echo $users['rname']; ?>>
 					</div>
 					<div id="users">
 					<a href="First.php" id="FirstBtn">首　页</a>
 					</div>
 					<div id="users">
 					<a href="#" id="logoutBtn" data-toggle="modal">退出系统</a>
 					</div>
 					<div id="users">
 					<a href="#" id="FirstBtn" data-toggle="modal">帮　助</a>
 					</div>
 				</div>
 				
 			</div>
 		</nav>
 	
 	<div class="container">
	 	<div class="row">
		 		<div class="col-xs-12">
	 			<div  id="marginal"></div>
	 			<div class="col-xs-3 titles">
	 			<ul class="sf-menu sf-vertical">
						<li class="current">
							<a href="#" id="a">用户登陆管理</a>
							<ul>
								<li><a href="Alteruse.php" id="a">个人资料信息</a></li>
								<li><a href="Alterinfo.php" id="a">个人信息修改</a></li>
							</ul>
						</li>
						<li><a href="#" id="a">我的客户管理</a>
							<ul>
							<li><a href="success.php"id="a">成功客户列表</a></li>
				   			<li><a href="seekIn.php"id="a">挑入记录列表</a></li>
				   			<li><a href="seekOut.php"id="a">挑出记录列表</a></li>
				   			<li><a href="myClient.php"id="a">我的客户列表</a></li>
				   			<li><a href="publicClient.php"id="a">公共客户列表</a></li>
							</ul>
						</li>
						<li><a href="#" id="a">业务产品管理</a>
							<ul>
								<li><a href="companyProduct.php"id="a">公司产品</a></li>
				   				<li><a href="myTrade.php"id="a">我的交易</a></li>
				   			</ul>
				   		</li>
						<li><a href="#" id="a">全部客户管理</a>
							<ul>
								<li><a href="allClient.php"id="a">全部客户列表</a></li>
				   			</ul>
						</li>
						<li><a href="#" id="a">全体职员管理</a>
							<ul>
								<li><a href="allphpWorker.php"id="a">全体职员列表</a></li>
				   			</ul>
						</li>
						<li><a href="#" id="a">销售客户统计</a>
							<ul>
								<li><a href="#"id="a">全体销售代表成绩表</a></li>
				   			</ul>
						</li>
						<li><a href="#" id="a">销售部门管理</a>
							<ul>
								<li><a href="sell.php"id="a">销售部列表</a></li>
				   			</ul>
						</li>
						<li><a href="#" id="a">系统用户管理</a>
							<ul>
								<li><a href="systemUse.php"id="a">系统用户列表</a></li>
				   			</ul>
						</li>
						<li><a href="#" id="a">角色权限管理</a>
							<ul>
								<li><a href="systemUseRole.php"id="a">系统用户角色列表</a></li>
				   			</ul>
						</li>
						<li><a href="#" id="a">客户跟进管理</a>
							<ul>
								<li><a href="#"id="a">待跟进客户列表</a></li>
				   				<li><a href="myTabb.php"id="a">我的客户跟进列表</a></li>
				   			</ul>
						</li>
					</ul>
	 			</div>
	 			<div class="col-xs-8 main">
				 	<div class="panel panel-default">
			 			<div class="panel-heading">
			 					<div class="panel-title">
					 				<h4>与客户－《<?php echo $client['name']; ?>》交易</h4>
			 					</div>
			 			</div>
			 			<div class="panel-body">
			 				  <form id="submitFrom" action="ProcessTrade.php" method="post" class="form-horizontal">
			 				   <div class="form-group">
			                    <div id="pic" class="col-xs-4 col-xs-offset-3">
			                    	<img id="imgView" src="img/1.jpeg" width="190" height="150"/>
			                    </div>
			                    </div>
		                    <div class="form-group">
		                        <label class="control-label col-sm-4 hidden-xs">商　　品：</label>
		                        <div class="col-sm-8">
								   <select class="form-control" name="name">
		        				 		 <option>请选择商品</option>
			        				 	 <?php foreach ($product as $products){ ?>
			        				 	 <option id="select" value="<?php echo $products['id']; ?>"><?php echo $products['name']; ?></option>
			        					  <?php }?>
		        		 		 </select>
		                        </div>
		                    </div>
		                    <div class="form-group">
		                        <label class="control-label col-sm-4 hidden-xs">单　　价：</label>
		                        <div class="col-sm-8">
		                            <input name="price" value="0" class="form-control" disabled="disabled"/>
		                        </div>
		                    </div>
		                    <div class="form-group">
		                        <label class="control-label col-sm-4 hidden-xs">数　　量：</label>
		                        <div class="col-sm-8">
		                            <input name="amount" class="form-control" type="number">
		                        </div>
		                    </div>
		                      <div class="form-group">
		                        <label class="control-label col-sm-4 hidden-xs">应　　付：</label>
		                        <div class="col-sm-8">
		                            <input name="cope" class="form-control" type="number"  disabled="disabled"/>
		                        </div>
		                    </div>
		                    <div class="form-group">
		                        <label class="control-label col-sm-4 hidden-xs">实　　付：</label>
		                        <div class="col-sm-8">
		                            <input name="money" class="form-control" placeholder="实付金额" type="number"/>
		                        </div>
		                    </div>
		                    <div class="row">
		                        <div class="col-xs-6 col-xs-offset-6">
		                            <button type="submit" class="btn btn-default">交　易</button>
		                          	<a href="myClient.php" class="btn btn-default">上一级</a>
		                          	</div>
		                     </div>
		                   </form>
			 			</div>
			 		</div>
	 			</div>
	 		</div>
	 	</div>
 	</div>
 </body>
   <script>
   	$('.dropdown-submenu > a').submenupicker();
   	$('.sf-menu').superfish();
   </script>
</html>